<% layout('/layouts/default.html', {title: '小程序用户', libs: ['dataGrid']}){ %>

<div class="main-content">
	<div class="box box-main">
		<div class="box-header">
			<div class="box-title">
				<i class="fa fa-list-alt"></i> ${text('售后列表')}
			</div>
			<div class="box-tools pull-right">
				<a href="#" class="btn btn-default" id="btnSearch" title="${text('查询')}"><i class="fa fa-filter"></i> ${text('查询')}</a>

			</div>
		</div>
		<div class="box-body">
			<#form:form id="searchForm" model="${ztAfterSale}" action="${ctx}/ztAfterSale/listData" method="post" class="form-inline hide"
					data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">
				 			
				<div class="form-group">
					<label class="control-label">${text('渠道')}：</label>
					<div class="control-inline width-120">
						<#form:select path="spotid" dictType="zt_spotid_type" blankOption="true" class="form-control width-120"/>
					</div>
				</div>
			<div class="form-group">
				<label class="control-label">${text('服务环节')}：</label>

				<div class="control-inline width-120">
					<#form:select path="afsServiceStep" dictType="zt_afsServiceStep_type" blankOption="true" class="form-control width-120"/>
				</div>

			</div>
				<div class="form-group">
					<button type="submit" class="btn btn-primary btn-sm">${text('查询')}</button>
					<button type="reset" class="btn btn-default btn-sm">${text('重置')}</button>
				</div>
			</#form:form>
			<table id="dataGrid"></table>
			<div id="dataGridPage"></div>
		</div>
	</div>
</div>
<% } %>
<script>
// 初始化DataGrid对象
$('#dataGrid').dataGrid({
	searchForm: $("#searchForm"),
	columnModel: [
		{header:'${text('渠道')}', name:'spotid', index:'spotid', width:95, align:"center",formatter: function(val, obj, row, act){
				if(row.spotid==1){
					return '京东';
				}else if (row.spotid==0){
					return '自营';
				} else {return '京东';}

			}},
		{header:'${text('商品编号')}', name:'skuId', index:'skuId', width:95, align:"center"},
		{header:'${text('商品名称')}', name:'wareName', index:'wareName', width:180, align:"center"},
		{header:'${text('商品图片')}', name:'img', index:'img', width:100, align:"center",frozen:true, formatter: function(val, obj, row, act){
			return '<img style="width:43px;height:43px;" src="'+val+'"></img>';
		}},
		{header:'${text('数量')}', name:'num', index:'num', width:90, align:"center"},

		{header:'${text('服务环节')}', name:'afsServiceStepName', width:100, align:"center"},

		{header:'${text('售后类型')}', name:'type', width:120, align:"center" ,formatter: function(val, obj, row, act){
			if(row.type==10){
				return '退货';
			}else if (row.type==20){
				return '换货';
			} else {return '维修';}

		}},
		{header:'${text('返件方式')}', name:'takeType', width:120, align:"center" ,formatter: function(val, obj, row, act){
				if(row.takeType==4){
					return '上门取件';
				}else if (row.takeType==7){
					return '客户送货';
				} else {return '上门取件';}

			}},

		{header:'${text('操作')}', name:'actions', width:85, align:"center", sortable:false, title:false, formatter: function(val, obj, row, act){
			var actions = [];
			<% if(hasPermi('ztAfterSale:ztAfterSale:edit')){ %>
				actions.push('<a href="${ctx}/ztAfterSale/form?id='+row.id+'" class="btnList" title="${text('编辑用户')}"><i class="fa fa-pencil"></i></a>&nbsp;');
			<% } %>
			return actions.join('');
		}}
	],
	// 加载成功后执行事件
	ajaxSuccess: function(data){
		
	}
});

</script>